package Y2024.M12.D3;

import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25228
 * Date: 2024-12-03
 * Time: 11:13
 */
public class Main2 {
    public static void main(String[] args) {
        Client client = new Client();
        client.someMethod();
    }
}

class TaskClass1 implements Runnable{
    int n=0;
    public TaskClass1(int n){
        this.n=n;
    }
    @Override
    public void run() {
        File file=new File("F:/Dir_1");
        if (!file.exists()){
            file.mkdir();
        }
        for (int i = 0; i < n; i++) {
            File file1=new File("F:/Dir_1/Thread1_"+"i"+".txt");
        }
    }
}

class TaskClass2 implements Runnable{
    int n=0;
    public TaskClass2(int n){
        this.n=n;
    }
    @Override
    public void run() {
        File file=new File("F:/Dir_2");
        if (!file.exists()){
            file.mkdir();
        }
        for (int i = 0; i < n; i++) {
            File file1=new File("F:/Dir_1/Thread2_"+"i"+".txt");
        }
    }
}

class TaskClass3 implements Runnable{
    int n=0;
    public TaskClass3(int n){
        this.n=n;
    }
    @Override
    public void run() {
        int s=0;
        for (int i = 0; i <= n; i++) {
            System.out.println("计算到了:"+i);
            s+=i;
        }
        System.out.println(s);
    }
}


class Client{

    public void someMethod(){
        Thread thread1 = new Thread(new TaskClass1(10));
        thread1.start();

        Thread thread2 = new Thread(new TaskClass2(10));
        thread2.start();

        Thread thread3 = new Thread(new TaskClass3(10));
        thread3.start();
    }
}